package com.example.dmy.bootoauth.service;

import com.example.dmy.bootoauth.dao.OauthUserMapper;
import com.example.dmy.bootoauth.domain.OauthUser;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * @Author: daimengying
 * @Date: 2019/1/7 18:04
 * @Description:
 */
@Service
public class OauthUserService {
    @Resource
    OauthUserMapper oauthUserMapper;

    public OauthUser getByUsername(String username){
        Example example = new Example(OauthUser.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("username",username);
        return oauthUserMapper.selectByExample(example).get(0);
    }
}
